package org.ehe.erp.domain.quality.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.ehe.common.mybatis.core.domain.BaseEntity2;
import org.ehe.erp.domain.quality.ErpQualityTask;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import java.time.LocalDateTime;

/**
 * 质检任务业务对象
 *
 * @author zhangnn
 * @className ErpQualityTaskBo
 * @description 质检任务BO，用于业务逻辑处理
 * @date 2025-09-10 15:00:00
 */
@Data
@AutoMapper(target = ErpQualityTask.class, reverseConvertGenerate = false)
public class ErpQualityTaskBo extends BaseEntity2 {

    private Long id;

    @NotBlank(message = "质检任务单号不能为空")
    @Length(max = 255, message = "质检任务单号长度不能超过255字符")
    private String taskNo;


    @NotNull(message = "BOM ID不能为空")
    private Long bomId;

    /** 采购 订单编号 ***/
    @NotBlank(message = "采购 订单编号不能为空")
    private String orderNo;
    /** 采购 订单名称 ***/
    private String orderName;

    @NotNull(message = "状态不能为空")
    @Range(min = 0, max = 4, message = "状态值必须在0-4之间")
    private Integer status = 0;

    @Range(min = 1, max = 3, message = "优先级必须在1-3之间")
    private Integer priority = 1;

    private Long assignUserId;

    @Length(max = 100, message = "组装质检人员姓名长度不能超过100字符")
    private String assignUserName;

    private LocalDateTime startTime;
    private LocalDateTime completeTime;
    private Integer timeoutDuration;
    private LocalDateTime timeoutAlarmTime;
    private Integer isTimeout = 0;

    @Length(max = 1000, message = "备注长度不能超过1000字符")
    private String remark;

    /**
     *   PENDING_SUBMIT(0,"待提交"),
     *     SUBMITTED(1,"已提交"),
     *     REJECTED(9,"已拒绝"),
     *     PROCESS(10, "审核中"), // 审核中
     *     APPROVE(20, "已审核"); // 审核通过
     */
    private String approveStatus;

    /**
     * 预估完成小时数
     */
    private Integer estimatedHours;
    /**
     * 任务截止时间
     */
    private LocalDateTime taskDeadline;

    /**
     * 任务是否超期
     */
    private String isTaskTimeout;

    /**
     * 响应是否超期：处理状态：0-未处理，1-已处理，2-已超期,3-超期未处理，4超期已处理
     * 与respondTime一样。只是统一字段
     */
    private String isOverdue;

    /**
     * 响应 截止时间
     */
    private LocalDateTime isOverdueEndTime;
}
